﻿using System.IO;
using Ninject;
using NUnit.Framework;

using System.Net.DnsToolkit.Packet;
using System.Net.DnsToolkit.Serializer;
using System.Net.DnsToolkit.Configuration;
using System.Net.DnsToolkit.Bastard.PacketGenerator;
using System.Net.DnsToolkit.Util;

namespace System.Net.DnsToolkit.TestUnit.Bastard.PacketGenerator {

    [TestFixture]
    public class MultipleSameQuestionsTest {

        [Test]
        public void TestGetMessage() {

            var generator = new MultipleSameQuestions();
            var message = generator.GetMessage();

            Assert.AreEqual(65, message.Questions.Count, "Questions.Count");
            Assert.AreEqual(65, message.Header.QuestionCount, "Header.QuestionCount");
            Assert.AreEqual("darkdns.codeplex.com", message.Questions[0].QName.Name, "0");
            Assert.AreEqual("darkdns.codeplex.com", message.Questions[1].QName.Name, "1");
            Assert.AreEqual("darkdns.codeplex.com", message.Questions[10].QName.Name, "10");
            Assert.AreEqual("darkdns.codeplex.com", message.Questions[49].QName.Name, "80");

        }

        [Test]
        public void TestGetBytes() {


            var generator = new MultipleSameQuestions();
            byte[] bs = generator.GetBytes();
            Assert.GreaterOrEqual(bs.Length, 400, "length");
            Assert.LessOrEqual(bs.Length, 450, "length");
          
        }

    }
}
